<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/layouts/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="${ctxLib }/lightbox2/2.8.1/css/lightbox.css">
<title>上传图片列表</title>
<style>
	td.Hui-iconfont {
		font-size: 38px;
		line-height: 50px;
		margin: 10px 0;
		color: #333;
		-webkit-transition: font-size 0.25s ease-out 0s;
		-moz-transition: font-size 0.25s ease-out 0s;
		transition: font-size 0.25s ease-out 0s
	}
	.center-font{
		font-size: 38px;
		line-height: 40px;
	}
</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 附件管理 <span class="c-gray en">&gt;</span> 图片管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"></span> <span class="r">共有数据：<strong id="totalCount">54</strong> 条</span> </div>
	<table class="table table-border table-bordered table-striped"  id="example">
		<thead>
			<tr>
				<th scope="col" colspan="9">员工列表</th>
			</tr>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="150">图片名称</th>
				<th width="90">图片大小</th>
				<th width="130">上传时间</th>
				<th width="200">操作</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
</div>
<!--_footer 作为公共模版分离出去-->
<script src="${ctxLib }/lightbox2/2.8.1/js/lightbox-plus-jquery.min.js"></script>
<script type="text/javascript" src="${ctxLib }/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="${ctxLib }/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${ctxStatic}/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="${ctxStatic}/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${ctxLib }/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${ctxLib }/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="${ctxLib }/shopUtil.js"></script>



<script type="text/javascript">
$(function() {
	query();
});

function query(){
	var url = "${ctx}/attachment/list";
	$("#example").dataTable({
		"searching" : false,
		"bPaginate" : true,		//开启分页
		"bLengthChange" : 10,	// 每行显示记录数  
        "iDisplayLength" : 6,		// 每页显示行数
		"bLengthChange":true,//是否显示一个每页长度的选择条
		"aLengthMenu":[[10, 20, 30, -1], [10, 20, 30, "All"]],	//第一个为显示每页条目数的选项，第二个是关于这些选项的解释
		"bAutoWidth": true, 		//是否自适应宽度
		"bProcessing":true,		//是否显示“正在处理”这个提示信息
		"bSort":false,				//是否让各列具有按列排序功能
		"bStateSave":true,			//是否打开客户端状态记录功能
		"bDestroy":true,			//dataTable绑定时，将之前的那个数据对象清除掉，换以新的对象设置
		"serverSide":true,			//开启服务器处理模式
		"sAjaxSource":url,			//请求资源路径
		/*
		 使用ajax，在服务端处理数据
		 sSource:即是"sAjaxSource"
		 aoData:要传递到服务端的参数
		 fnCallback:处理返回数据的回调函数
		 */
		 "fnServerData": function(sSource, aoData, fnCallback){
			 var data = {"aodata" : JSON.stringify(aoData)};
			  $.ajax( { 
				  'type' : 'POST', 
				  "url": sSource, 
				  "dataType": "json", 
				  "data": data,
				  "success": function(resp) { 
					  	$("#totalCount").text(resp.iTotalRecords);
				   		fnCallback(resp);
				   } 
			  }); 
		 }, 
		 "columns": [
				        { "data": "id","className":"text-c" },
				        { "data": "fileName","className":"text-c" },
				        { "data": "fileSize","className":"text-c" },
				        { "data": "createDate","className":"text-c" },
				        { "data": null,"className":"text-c" }
				    ],
				    "columnDefs": [{
				        targets: 0,
				        render: function(data, type, row, meta) {
				        	return '<input type="checkbox" name="checkitem"  id="check'+data+'" value="'+data+'"/>';
				        }
				    },{
				    	targets: 2,
				        render: function(data, type, row, meta) {
				        	return data+"kb";
				        }
				    },{
				        targets: 3,
				        render: function(data, type, row, meta) {
				        	return new Date(data).Format('yyyy-MM-dd hh:mm:ss');
				        }
				    },
				    {
				    	targets: 4,
				        render: function(data, type, row, meta) {
				            return '<a title="编辑" href="'+data.url+'" data-lightbox="example-1" data-title="'+data.fileName+'"  class="example-image-link ml-5" style="text-decoration:none">'+
				            '<i class="Hui-iconfont center-font">&#xe646;</i></a> ';
				        }
				    }]
	});
}
</script>
</body>
</html>